package com.study.tiger.controller;

import com.study.tiger.pojo.BaseTree;
import com.study.tiger.pojo.City;
import com.study.tiger.register.ResponseResult;
import com.study.tiger.service.TreeService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api")
@Api(tags="构建tree")
public class TreeController {

    @Autowired
    TreeService treeService;

    @ApiOperation(value = "构建树，返回构建之后的结果")
    @PostMapping("/buildTree")
    public ResponseResult<List<City>> buildTree(@ApiParam(value = "转换前List",required = true) @RequestBody List<City> list){
        return ResponseResult.success(treeService.BuildTree(list));
    }
}
